﻿using XYS.Core.Models;

namespace XYS.Core.Util;
public static partial class Extention
{
    /// <summary>
    /// 转换为指定类型的失败模型
    /// </summary>
    /// <typeparam name="TTarget"></typeparam>
    /// <param name="resultModel"></param>
    /// <returns></returns>
    public static ResultModel<TTarget> ToFailed<TTarget>(this ResultModel resultModel)
    {
        return ResultModel<TTarget>.Failed(resultModel.Error, resultModel.StatusCode);
    }

}